package cn.accjiyun.inventory.model;

import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;

/**
 * Created by jiyun on 2016/7/5.
 */
@Entity
public class Goods {
    private String id;
    private String name;
    private Integer type;
    private Integer inventory;
    private Integer maxnum;
    private int minnum;
    private String supplierId;

    @Id
    @Column(name = "id", nullable = false, length = 8)
    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    @Basic
    @Column(name = "name", nullable = false, length = 20)
    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    @Basic
    @Column(name = "type", nullable = true)
    public Integer getType() {
        return type;
    }

    public void setType(Integer type) {
        this.type = type;
    }

    @Basic
    @Column(name = "inventory", nullable = true)
    public Integer getInventory() {
        return inventory;
    }

    public void setInventory(Integer inventory) {
        this.inventory = inventory;
    }

    @Basic
    @Column(name = "maxnum", nullable = true)
    public Integer getMaxnum() {
        return maxnum;
    }

    public void setMaxnum(Integer maxnum) {
        this.maxnum = maxnum;
    }

    @Basic
    @Column(name = "minnum", nullable = false)
    public int getMinnum() {
        return minnum;
    }

    public void setMinnum(int minnum) {
        this.minnum = minnum;
    }

    @Basic
    @Column(name = "supplierId", nullable = false, length = 8)
    public String getSupplierId() {
        return supplierId;
    }

    public void setSupplierId(String supplierId) {
        this.supplierId = supplierId;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        Goods goods = (Goods) o;

        if (minnum != goods.minnum) return false;
        if (id != null ? !id.equals(goods.id) : goods.id != null) return false;
        if (name != null ? !name.equals(goods.name) : goods.name != null) return false;
        if (type != null ? !type.equals(goods.type) : goods.type != null) return false;
        if (inventory != null ? !inventory.equals(goods.inventory) : goods.inventory != null) return false;
        if (maxnum != null ? !maxnum.equals(goods.maxnum) : goods.maxnum != null) return false;
        if (supplierId != null ? !supplierId.equals(goods.supplierId) : goods.supplierId != null) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = id != null ? id.hashCode() : 0;
        result = 31 * result + (name != null ? name.hashCode() : 0);
        result = 31 * result + (type != null ? type.hashCode() : 0);
        result = 31 * result + (inventory != null ? inventory.hashCode() : 0);
        result = 31 * result + (maxnum != null ? maxnum.hashCode() : 0);
        result = 31 * result + minnum;
        result = 31 * result + (supplierId != null ? supplierId.hashCode() : 0);
        return result;
    }
}
